package com.youkeyi.ddy.cloud.common.api.application.applet.crm.customer;

import com.youkeyi.ddy.cloud.common.api.application.applet.crm.customer.dto.AppletCustomerDetailCloudDto;
import com.youkeyi.ddy.cloud.common.api.application.applet.crm.customer.dto.AppletCustomerListCloudDto;
import com.youkeyi.ddy.cloud.common.api.application.applet.crm.customer.param.*;
import com.youkeyi.ddy.cloud.common.api.application.system.user.dto.SystemUserDetailCloudDto;
import com.youkeyi.ddy.cloud.common.response.ResponseContent;
import io.swagger.annotations.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 客户
 *
 * @author  liuxiawang
 * @Date 5/24/22 10:36 PM
 * @Location shenzhen.china
 */
@Api(tags = {"Customer management"})
@RestController
@FeignClient(value = "YOUKEYI-DDY-CLOUD-APPLICATION-APPLET", fallback = AppletCustomerCloudServiceFallback.class)
@RequestMapping("/applet/customer")
public interface AppletCustomerCloudService {

    // 查询客户列表
    @ApiOperation(value = "Query Customer List", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.applet.crm.customer.AppletCustomerCloudService.list")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = AppletCustomerListCloudDto.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "query", value = "Param of Query Customer List", dataType = "AppletCustomerListCloudParam", dataTypeClass = AppletCustomerListCloudParam.class),
    })
    @GetMapping
    public abstract AppletCustomerListCloudDto list(AppletCustomerListCloudParam param);

    // 查询客户详情
    @ApiOperation(value = "Query Customer Detail", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.applet.crm.customer.AppletCustomerCloudService.detail")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = SystemUserDetailCloudDto.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "customerPrimaryKey", paramType = "path", value = "Param of Query Customer Detail", dataType = "String", dataTypeClass = String.class),
    })
    @GetMapping("/{customerPrimaryKey}")
    public abstract AppletCustomerDetailCloudDto detail(@PathVariable("customerPrimaryKey") String customerPrimaryKey);

    // 创建客户
    @ApiOperation(value = "Create Customer", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.applet.crm.customer.AppletCustomerCloudService.create")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = ResponseContent.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "body", value = "Param of Create Customer", dataType = "AppletCustomerCreateCloudParam", dataTypeClass = AppletCustomerCreateCloudParam.class),
    })
    @PostMapping("/create")
    public abstract ResponseContent create(@RequestBody AppletCustomerCreateCloudParam param);

    // 编辑客户
    @ApiOperation(value = "Update Customer", authorizations = {@Authorization("com.youkeyi.ddy.cloud.common.api.application.applet.crm.customer.AppletCustomerCloudService.update")})
    @ApiResponse(code = 200, message = "data Property in Response Body", response = ResponseContent.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "param", paramType = "body", value = "Param of Update Customer", dataType = "AppletCustomerUpdateCloudParam", dataTypeClass = AppletCustomerUpdateCloudParam.class),
    })
    @PatchMapping("update")
    public abstract ResponseContent update(@RequestBody AppletCustomerUpdateCloudParam param);

}
